@extends('admin.main')
@section('body')
    <div class="main-title">
        <h2>网站设置</h2>
    </div>
    <div class="tab-wrap">
        <ul class="tab-nav nav">
            @if(count($config['CONFIG_GROUP_LIST']))
                @foreach($config['CONFIG_GROUP_LIST'] as $k=>$v)
                    <li @if(request('id',1) == $k)class="current"@endif><a
                                href="{{urlAdmin('config','getGroup',['id'=>$k])}}">{{$v}}配置</a></li>
                @endforeach
            @endif
        </ul>
        <div class="tab-content">
            <form action="{{urlAdmin('config','postSave')}}" method="post" class="form-horizontal">
                @if(count($rows))
                    @foreach($rows as $v)
                        <div class="form-item">
                            <label class="item-label">{{$v['title']}}<span class="check-tips">（{{$v['remark']}}）</span></label>
                            <div class="controls">
                                @if($v['type'] == 0)
                                    <input type="text" class="text input-small" name="config[{{$v['name']}}]"
                                           value="{{$v['value']}}">
                                @endif
                                @if($v['type'] == 1)
                                    <input type="text" class="text input-large" name="config[{{$v['name']}}]"
                                           value="{{$v['value']}}">
                                @endif
                                @if($v['type'] == 2)
                                    <label class="textarea input-large">
                                        <textarea name="config[{{$v['name']}}]">{{$v['value']}}</textarea>
                                    </label>
                                @endif
                                @if($v['type'] == 3)
                                    <label class="textarea input-large">
                                        <textarea name="config[{{$v['name']}}]">{{$v['value']}}</textarea>
                                    </label>
                                @endif
                                @if($v['type'] == 4)
                                    <select name="config[{{$v['name']}}]">
                                        @if($v['extra'])
                                            @foreach(parse_config_attr($v['extra']) as $k=>$m)
                                                <option value="{{$k}}"
                                                        @if($v['value'] == $k) selected @endif>{{$m}}</option>
                                            @endforeach
                                        @else
                                            <option>暂无数据</option>
                                        @endif
                                    </select>
                                @endif
                            </div>
                        </div>
                    @endforeach
                @endif
                <div class="form-item">
                    <label class="item-label"></label>
                    <div class="controls">
                        @if(!count($rows))
                            <button type="submit" disabled class="btn submit-btn disabled"
                                    target-form="form-horizontal">确 定
                            </button>
                        @else
                            <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定
                            </button>
                        @endif
                        <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
@endsection